import QtQuick 2.15
import QtQuick.Layouts 1.15
import org.ukui.quick.widgets 1.0
import org.ukui.quick.items 1.0
import QtQuick.Controls 2.15
import QtQuick.Controls 2.15 as Controls

WidgetItem {
    id: rootWidget
    Layout.preferredWidth: 450
    Layout.fillHeight: true
    clip: false

    RowLayout {
        anchors.centerIn: parent
        spacing: 10

        TextField {
            id: microsecondInput
            width: 200
            placeholderText: "输入微秒数"
            validator: RegExpValidator { regExp: /^[0-9]+$/ }
        }

        Button {
            text: "转换"
            width: 50
            onClicked: {
                var microseconds = microsecondInput.text;
                var minutes = (microseconds / 60000000).toFixed(6); // 1分钟 = 60,000,000微秒
                minuteOutput.text = isNaN(minutes) ? "无效" : minutes.toString();
            }
        }

        Text {
            id: minuteOutput
            width: 60
            horizontalAlignment: Text.AlignHCenter
            font.pixelSize: 20
        }
    }
}
